home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / allfiles / Itch / loading.dcr / 00006_Stroke Parent.ls < prev    next >
Encoding:
Text File  |  1999-03-07  |  1.5 KB  |  79 lines

  1. property state, strokeList, strokeTimer, sp, cst, pos, maxsp
  2.  
  3. on new me
  4.   me.state = #count
  5.   strokeList = []
  6.   makeList(me, strokeList, "stroke")
  7.   me.sp = 5
  8.   maxsp = me.sp + 25
  9.   me.cst = the member of sprite me.sp
  10.   me.pos = point(50, 148)
  11.   DrawtoStage(me)
  12.   return me
  13. end
  14.  
  15. on CheckState me
  16.   case me.state of
  17.     #default:
  18.     #count:
  19.       count(me, strokeList)
  20.   end case
  21. end
  22.  
  23. on SetUpPos me, aMem
  24.   me.sp = me.sp + 1
  25.   if me.sp >= maxsp then
  26.     me.state = #default
  27.   end if
  28.   UpdatePos(me, point(25, 0))
  29.   me.cst = aMem
  30.   set the member of sprite the sp of me to me.cst
  31.   DrawtoStage(me)
  32. end
  33.  
  34. on count me, aList
  35.   if the timer > strokeTimer then
  36.     tempPos = getOne(aList, me.cst)
  37.     if tempPos = count(aList) then
  38.       tempPos = 1
  39.     else
  40.       tempPos = tempPos + 1
  41.     end if
  42.     SwapCast(me, getAt(aList, tempPos), tempPos)
  43.     Cuestroketimer(me, 30)
  44.   end if
  45. end
  46.  
  47. on Cuestroketimer me, aNum
  48.   me.strokeTimer = the timer + aNum
  49. end
  50.  
  51. on makeList me, aList, aName
  52.   repeat with x = 1 to the maxinteger
  53.     if the number of member (aName & x) > 0 then
  54.       add(aList, member(aName & x))
  55.       next repeat
  56.     end if
  57.     exit repeat
  58.   end repeat
  59. end
  60.  
  61. on SwapCast me, aMem, aNum
  62.   case aNum of
  63.     1:
  64.       SetUpPos(me, aMem)
  65.     otherwise:
  66.       me.cst = aMem
  67.       set the member of sprite the sp of me to me.cst
  68.   end case
  69. end
  70.  
  71. on UpdatePos me, aPos
  72.   tempPos = me.pos + aPos
  73.   me.pos = tempPos
  74. end
  75.  
  76. on DrawtoStage me
  77.   set the loc of sprite the sp of me to me.pos
  78. end
  79.